<?php

require_once(TANGRA_MAIN_DIR.'form/guardable_form.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/text/form_field_text.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/textarea/form_field_textarea.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/email/form_field_email.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/checkbox/form_field_checkbox.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/integer_positive/form_field_integer_positive.class.php');
require_once(TANGRA_MAIN_DIR.'form/static_html_form_generator.class.php');


class RSS_Channel_Form extends Guardable_Form {
	function __construct() {
		parent::__construct('rss_channel', 'admin/modules/ap_rss_gen/rss_channel_edit.php');

		$f_title = new Form_Field_Textarea('title', true, 1000);
		$this->add_field($f_title);

		$f_link = new Form_Field_Text('link', true, 255);
		$this->add_field($f_link);

		$f_description = new Form_Field_Textarea('description', true, 5000);
		$this->add_field($f_description);

		$f_language = new Form_Field_Text('language', true, 5, 'en-us');
		$this->add_field($f_language);

		$f_copyright = new Form_Field_Text('copyright', false, 255);
		$this->add_field($f_copyright);

		$f_managing_editor = new Form_Field_Email('managing_editor', false);
		$this->add_field($f_managing_editor);

		$f_web_master = new Form_Field_Email('web_master', false);
		$this->add_field($f_web_master);

		$f_ttl = new Form_Field_Integer_Positive('ttl', true);
		$this->add_field($f_ttl);
	}


	public function generate_html() {
		$html_gen = new Static_HTML_Form_Generator($this, 'modules/form_html_tpl_static_ajax_metallic_en', 'en');
		$html_gen->create_default_tpl_maps();

		printbr('<pre>');
		printbr(htmlentities($html_gen->get_static_html()));
		printbr('</pre>');
	}
}
